//
//  StatusCellToomView.swift
//  weibo
//
//  Created by Qing on 2017/7/26.
//  Copyright © 2017年 成哥哥. All rights reserved.
//

import UIKit

class StatusCellBottomView: UIView {
    
    
    //    MARK: — 懒加载控件
    //评论按钮
    lazy var commentBtn: UIButton = UIButton(type: UIButtonType.system, image: "comment", title: " 评价", stated: UIControlState.normal)
    //转发按钮
    lazy var transmitBtn: UIButton = UIButton(type: UIButtonType.system, image: "share", title: " 转发", stated: UIControlState.normal)
    //点赞按钮
    lazy var likeBtn: UIButton = UIButton(type: UIButtonType.system, image: "like", title: " 赞", stated: UIControlState.normal)
    
//    lazy var segmentationLink: UIView = UIView()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setUI()
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    //MARK: 设置界面
    fileprivate func setUI() {
    
        //1.添加UI
        addSubview(commentBtn)
        addSubview(transmitBtn)
        addSubview(likeBtn)
        segmentationLint()

        
//        2.自动布局
//        1>评论按钮
        commentBtn.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top)
            make.left.equalTo(self.snp.left)
            make.bottom.equalTo(self.snp.bottom)
        }
//        2>转发按钮
        transmitBtn.snp.makeConstraints { (make) in
            make.top.equalTo(commentBtn.snp.top)
            make.left.equalTo(commentBtn.snp.right)
            make.bottom.equalTo(commentBtn.snp.bottom)
            make.width.equalTo(commentBtn.snp.width)
        }
//        3>点赞按钮
        likeBtn.snp.makeConstraints { (make) in
            make.top.equalTo(transmitBtn.snp.top)
            make.left.equalTo(transmitBtn.snp.right)
            make.bottom.equalTo(transmitBtn.snp.bottom)
            make.right.equalTo(self.snp.right)
            make.width.equalTo(commentBtn.snp.width)
        }
        
//        4>底部视图按钮分割线
        let seg1 = segmentationLint()
        let seg2 = segmentationLint()
        addSubview(seg1)
        addSubview(seg2)

        
        let w = 0.5
        
        seg1.snp.makeConstraints { (make) in
            make.left.equalTo(commentBtn.snp.right)
            make.width.equalTo(w)
            make.height.equalTo(commentBtn.snp.height).multipliedBy(0.4)
            make.centerY.equalTo(commentBtn.snp.centerY)
        }

        seg2.snp.makeConstraints { (make) in
            make.left.equalTo(transmitBtn.snp.right)
            make.width.equalTo(w)
            make.height.equalTo(transmitBtn.snp.height).multipliedBy(0.4)
            make.centerY.equalTo(transmitBtn.snp.centerY)
        }
        
    }
    
    
    /// 底部视图，按钮中间的分割线
    fileprivate func segmentationLint() -> UIView {
        
        let v: UIView = UIView()
        v.backgroundColor = UIColor.blue
        
        return v
    }


}
